package com.zhang.chatcenter.common.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * webMVC拦截器
 * @author 000095133
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {


    @Bean
    public HandlerInterceptor userInterceptor() {
        return new UserInterceptor();
    }

    /**
     * 配置拦截器
     *
     * @param registry
     * @author Mike
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userInterceptor());
    }
}
